const koa = require("koa");
const app = new koa();
const static = require('koa-static');
const log = require('../../utils/log');

const path = require("path");

if (process.argv.length < 3) {	
	log.info("node webserver.js port");
	return;
}

var port = parseInt(process.argv[2]);

//设置静态资源的路径 
const staticPath = './www_root'; 

// console.log("pwd:",__dirname);//__dirname 总是指向被执行 js 文件的绝对路径
log.info("pwd:",__dirname);

app.use(static(path.join(__dirname, staticPath)));

app.listen(port);

log.info("webserver started at port " + port);





